//this is login document
function login(){
	doLogin("/networkforum/main/login.do",loginReturn);
}
function loginReturn(data){
	eval(data);
	document.getElementById('header').style.marginTop = '25px!important'
}
function login2(){
	doLogin("/networkforum/main/login2.do",function(d){
		if(d == "true"){
			//window.history.go(-1)
			window.location = "/networkforum/main/redirect.do?url=/pages/user/user_main";
		}
		else{
			alert("登录失败!");
		}
	});
}


function doLogin(url,callBack){
	var userName = document.getElementById("userName").value;
	var userPassword = document.getElementById("userPassword").value;
	var number = 1;
	if(userName == null||userPassword==null){
		alert("请先输入用户名和密码");
		return;
	}
	var data = [{"name":"userName","value":userName},
	    		{"name":"userPassword","value":userPassword},
	    		{"name":"number","value":number}];
	//var url = "login.do?userName= "+userName+" ? userPassword = "+userPassword+" ? number = "+number;
	//var url = "/networkforum/main/login.do";
	var myajax = getByAjax();
	myajax.init(data,"get",true);
	myajax.get(url,callBack);
}